﻿using DataTemplate.Model;
using DataTemplate.MyrControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DataTemplate
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class CarDemo : Window
    {
        public CarDemo()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            List<Car> cars = new List<Car>();
            cars.Add(new Car { ImgColor = new SolidColorBrush(Colors.Red), Name = "宝马", Year = "2015" });
            cars.Add(new Car { ImgColor = new SolidColorBrush(Colors.Blue), Name = "奔驰", Year = "2000" });
            cars.Add(new Car { ImgColor = new SolidColorBrush(Colors.Brown), Name = "保时捷", Year = "2012" });

            foreach (var car in cars)
            {
                CarListItemView view = new CarListItemView();
                view.Car = car;
                listBox.Items.Add(view);
            }
        }


    }
}
